package com.example.zk.configure;

import com.alibaba.fastjson.JSONObject;
import org.I0Itec.zkclient.ZkClient;

public class testzk {
    /**
     *  DriverManagerDataSource dataSource = new DriverManagerDataSource();
     *         dataSource.setDriverClassName("com.mysql.jdbc.Driver");
     *         dataSource.setUrl("jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC");
     *         dataSource.setUsername("root");
     *         dataSource.setPassword("root");
     * @param arge
     */
    public  static  void  main(String[] arge){
        JSONObject json=new JSONObject();
        json.put("DriverClassName","com.mysql.jdbc.Driver");
        json.put("Url","jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC");
        json.put("Username","root");
        json.put("Password","root");

        ZkClient zkClient = new ZkClient("192.168.115.129:2181");
        zkClient.writeData("/dataSource",json);
        System.out.println("成功");

    }
}
